/*
 * Copyright 2009 Geoffrey Chandler
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.stuffedit.search;

import java.util.List;
import java.util.ArrayList;

/**
 * This is a result set for a paged search.
 * <p/>
 * <small>
 * Submitted by geoffc on Mar 14, 2009 at 11:16:44 PM
 * </small>
 *
 * @author Geoffrey Chandler, geoffc@gmail.com
 */
public class PagedSearchResultSet<T> {
    private int totalResults;
    private int startIndex;
    private List<SearchResult> results;

    public PagedSearchResultSet() {
        this.results = new ArrayList<SearchResult>();
    }

    public void setTotalResults(int totalResults) {
        this.totalResults = totalResults;
    }

    public void setStartIndex(int startIndex) {
        this.startIndex = startIndex;
    }

    public void addResult(T document, float score) {
        this.results.add(new SearchResult<T>(document, score));
    }

    public List<SearchResult> getResults() {
        return results;
    }

    public int getStartIndex() {
        return startIndex;
    }

    public int getTotalResults() {
        return totalResults;
    }
}
